/*
 * Copyright (C), 2015-2019
 * FileName: ConstantInfoUft8
 * Author:   lizhao
 * Date:     2019-02-11 12:36
 * Description: utf8编码字符串
 * History:
 * <author>          <time>          <version>          <desc>
 * 作者姓名           修改时间           版本号              描述
 */
package com.lizhaoblog.jjvm.classfile.constantpool.impl;

import com.lizhaoblog.jjvm.classfile.ClassReader;
import com.lizhaoblog.jjvm.classfile.constantpool.BaseConstantInfo;
import com.lizhaoblog.jjvm.classfile.constantpool.ConstantInfo;

/**
 * 〈一句话功能简述〉<br>
 * 〈utf8编码字符串 u1+u2+length〉
 *
 * @author lizhao
 * @date 2019-02-11 12:36
 * @since 1.0.0
 */
public class ConstantInfoUft8 extends BaseConstantInfo implements ConstantInfo {

    public ConstantInfoUft8(ClassReader reader) {
        int length = reader.nextU2ToInt();// u2
        byte[] bytes = reader.nextBytes(length);
        value = new String(bytes);
    }
}
